package com.test.service.base;

import com.test.constants.ErrorCode;
import com.test.dto.base.BaseDto;
import com.test.dto.base.BaseResultDto;

public abstract class BaseService {
	
	protected BaseDto getResult() {
		return getResult(ErrorCode.SUCCESS);
	}
	
	protected BaseDto getResult(Object result) {
		return getResult(ErrorCode.SUCCESS, result);
	}
	
	protected BaseDto getResult(ErrorCode errorCode) {
		BaseDto baseDto = new BaseDto();
		baseDto.setErrcode(errorCode.getErrCode());
		baseDto.setErrmsg(errorCode.getErrMsg());
		return baseDto;
	}
	
	protected BaseDto getResult(ErrorCode errorCode, Object result) {
		BaseResultDto baseDto = new BaseResultDto();
		baseDto.setErrcode(errorCode.getErrCode());
		baseDto.setErrmsg(errorCode.getErrMsg());
		baseDto.setResult(result);
		return baseDto;
	}
	
	

}
